//package com.yx.b34.task;
//
//import android.util.Log;
//
//import com.tuya.smart.android.user.api.IRegisterCallback;
//import com.tuya.smart.android.user.bean.User;
//import com.tuya.smart.home.sdk.TuyaHomeSdk;
//import com.yx.b34.event.MessageEvent;
//
//import org.greenrobot.eventbus.EventBus;import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
//
//
///**
// * Created by Administrator on 2018/12/26.
// */
//
//public class RegisterTask {
//    private static final String TAG = "RegisterTask";
//    public static final int REGISTER_TYPE_PHONE = 0;
//    public static final int REGISTER_TYPE_EMAIL = 1;
//    public static void register(int type,final String countryCode, final String phone, final String passwd, final String code){
//        switch (type){
//            case REGISTER_TYPE_PHONE:
//                TuyaHomeSdk.getUserInstance().registerAccountWithPhone(countryCode,phone,passwd,code, new IRegisterCallback() {
//                    @Override
//                    public void onSuccess(User user) {
//                        Log.d(TAG,"registration success");
//                        MessageEvent event = new MessageEvent();
//                        event.setMessageType(MessageEvent.MESSAGE_TYPE_REGISTER);
//                        event.setCode("SUCCESS");
//                        EventBus.getDefault().post(event);
//                    }
//                    @Override
//                    public void onError(String code, String error) {
//                        Log.d(TAG,"registration failed, error code:" + code + " " + error);
//                        MessageEvent event = new MessageEvent();
//                        event.setMessageType(MessageEvent.MESSAGE_TYPE_REGISTER);
//                        event.setCode(code);
//                        event.setMessage(error);
//                        EventBus.getDefault().post(event);
//                    }
//                });
//                break;
//            case REGISTER_TYPE_EMAIL:
//                //邮箱密码注册
//                TuyaHomeSdk.getUserInstance().registerAccountWithEmail(countryCode,phone,passwd,code, new IRegisterCallback() {
//                    @Override
//                    public void onSuccess(User user) {
//                        Log.d(TAG,"registration success");
//                        MessageEvent event = new MessageEvent();
//                        event.setMessageType(MessageEvent.MESSAGE_TYPE_REGISTER);
//                        event.setCode("SUCCESS");
//                        EventBus.getDefault().post(event);
//                    }
//
//                    @Override
//                    public void onError(String code, String error) {
//                        Log.d(TAG,"registration failed, error code:" + code + " " + error);
//                        MessageEvent event = new MessageEvent();
//                        event.setMessageType(MessageEvent.MESSAGE_TYPE_REGISTER);
//                        event.setCode(code);
//                        event.setMessage(error);
//                        EventBus.getDefault().post(event);
//                    }
//                });
//                break;
//        }
//    }
//}
